module.exports = {
  api(util) {
    return {
      ...require('./user')(util),

      'use /api-dev': (req, res, next) => {
        var delay = 500
        console.log('--- ', req.method, req.url)
        console.log('sleep:', delay)
        new Promise((resolve) => setTimeout(resolve, delay)).then(() => {
          next()
        })
      }
    }
  },
  getPath: (path, basePath, method) => {
    return method || 'post' + ' /api-dev/' + basePath + path
  },
  resp: (res, data) => res.send({ code: 200, data }),
  respFailed: (res, message, code) => res.send({ code: code || 400, message })
}

